package cn.tedu.mall.seckill.exception;

import cn.tedu.mall.common.restful.JsonResult;
import cn.tedu.mall.common.restful.ResponseCode;
import cn.tedu.mall.pojo.seckill.dto.SeckillOrderAddDTO;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import lombok.extern.slf4j.Slf4j;

/**
 * @author BJ
 * @date 2022/11/10 11:50
 * 限流类的异常
 */
// 秒杀业务限流异常处理类
@Slf4j
public class SeckillBlockHandler {
    public JsonResult blockHandler(String randCode,
                                   SeckillOrderAddDTO seckillOrderAddDTO,
                                   BlockException e){
        log.error("一个请求被限流了！");
        return JsonResult.failed(ResponseCode.INTERNAL_SERVER_ERROR,"服务器忙，请稍后再试！！");
    }
}
